package o;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.PorterDuff.Mode;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
import android.os.Build.VERSION;
import androidx.annotation.NonNull;
import java.nio.ByteBuffer;
import java.security.MessageDigest;

public class cko extends wl {
    private static final byte[] ॱ = "EachRoundedCorners".getBytes(ˏ);
    private final float ˊ;
    private final float ˋ;
    private final float ˎ;
    private final float ॱॱ;

    public cko(float f, float f2, float f3, float f4) {
        this.ˋ = f;
        this.ˊ = f2;
        this.ˎ = f3;
        this.ॱॱ = f4;
    }

    protected Bitmap ॱ(@NonNull uc ucVar, @NonNull Bitmap bitmap, int i, int i2) {
        return ˋ(ucVar, bitmap);
    }

    private Bitmap ˋ(uc ucVar, Bitmap bitmap) {
        Config ˏ = ˏ(bitmap);
        Bitmap ˎ = ˎ(ucVar, bitmap);
        Bitmap ˊ = ucVar.ˊ(ˎ.getWidth(), ˎ.getHeight(), ˏ);
        ˊ.setHasAlpha(true);
        Shader bitmapShader = new BitmapShader(ˎ, TileMode.CLAMP, TileMode.CLAMP);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setShader(bitmapShader);
        RectF rectF = new RectF(0.0f, 0.0f, (float) ˊ.getWidth(), (float) ˊ.getHeight());
        Canvas canvas = new Canvas(ˊ);
        canvas.drawColor(0, Mode.CLEAR);
        Path path = new Path();
        path.addRoundRect(rectF, new float[]{this.ˋ, this.ˋ, this.ˊ, this.ˊ, this.ˎ, this.ˎ, this.ॱॱ, this.ॱॱ}, Direction.CW);
        canvas.drawPath(path, paint);
        ˊ(canvas);
        if (!ˎ.equals(bitmap)) {
            ucVar.ˏ(ˎ);
        }
        return ˊ;
    }

    private void ˊ(Canvas canvas) {
        canvas.setBitmap(null);
    }

    @NonNull
    private Config ˏ(@NonNull Bitmap bitmap) {
        if (VERSION.SDK_INT < 26 || !Config.RGBA_F16.equals(bitmap.getConfig())) {
            return Config.ARGB_8888;
        }
        return Config.RGBA_F16;
    }

    private Bitmap ˎ(@NonNull uc ucVar, @NonNull Bitmap bitmap) {
        Config ˏ = ˏ(bitmap);
        if (ˏ.equals(bitmap.getConfig())) {
            return bitmap;
        }
        Bitmap ˊ = ucVar.ˊ(bitmap.getWidth(), bitmap.getHeight(), ˏ);
        new Canvas(ˊ).drawBitmap(bitmap, 0.0f, 0.0f, null);
        return ˊ;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof cko)) {
            return false;
        }
        cko o_cko = (cko) obj;
        if (this.ˋ == o_cko.ˋ && this.ˊ == o_cko.ˊ && this.ˎ == o_cko.ˎ && this.ॱॱ == o_cko.ॱॱ) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        return aau.ˋ(this.ॱॱ, aau.ˋ(this.ˎ, aau.ˋ(this.ˊ, aau.ˏ("EachRoundedCorners".hashCode(), aau.ˊ(this.ˋ)))));
    }

    public void ॱ(@NonNull MessageDigest messageDigest) {
        messageDigest.update(ॱ);
        messageDigest.update(ByteBuffer.allocate(16).putFloat(this.ˋ).putFloat(this.ˊ).putFloat(this.ˎ).putFloat(this.ॱॱ).array());
    }
}
